<template>
  <el-dialog
    title="题目审核"
    :visible="choiceDialog"
    @close='onClose'
    width="400px">
    <el-form ref="form">
      <el-form-item>
        <el-radio-group v-model="checkForm.chkState">
          <el-radio :label="1">通过</el-radio>
          <el-radio :label="2">拒绝</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item>
        <el-input type="textarea" v-model="checkForm.chkRemarks" placeholder="请输入审核意见"></el-input>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="onClose">取 消</el-button>
      <el-button type="primary" @click="onCheck">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
import { choiceCheck } from '@/api/hmmm/questions.js'
export default {
  data () {
    return {
      checkForm: {
        chkState: 1,
        chkRemarks: ''
      }

    }
  },

  props: {
    choiceDialog: {
      type: Boolean,
      required: true
    },
    checkId: {
      type: Number,
      required: true
    }
  },

  methods: {
    // 关闭弹窗
    onClose () {
      this.$emit('update:choiceDialog', false)
    },

    // 点击确定
    async onCheck () {
      await choiceCheck({
        id: this.checkId,
        ...this.checkForm
      })
      this.$emit('refresh')
      this.$message.success('操作成功')
      this.onClose()
    }
  }
}
</script>

<style scoped lang='less'></style>
